//
//  UIView+Ex.swift
//  
//
//  Created by xiaoZuDeMeng on 2022/4/26.
//

import Foundation
import UIKit

extension UIView {
    func addCornerRadius(radius: CGFloat, corner: UIRectCorner) {
        self.layoutIfNeeded()
        let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corner, cornerRadii: CGSize(width: radius, height: radius))
        let shapeLayer = CAShapeLayer()
        shapeLayer.frame = self.bounds
        shapeLayer.path = path.cgPath
        self.layer.mask = shapeLayer
    }
}
